import service from "@/api/axios";
// 获取配置类型信息列表
export const getConfigListApi = (data) => {
    return service({
        url: "/configManage",
        method: "GET",
        params: data
    })
}
// 修改配置类型信息
export const updateConfigApi = (data) => {
    return service({
        url: "/configManage",
        method: "POST",
        data
    })
}
// 添加配置类型信息
export const addConfigApi = (data) => {
    return service({
        url: "/configManage",
        method: "PUT",
        data
    })
}

// 添加配置类型数据信息
export const addConfigDataApi = (data) => {
    return service({
        url: "/configManage/addConfigData",
        method: "PUT",
        data
    })
}

// 删除配置类型数据信息
export const delelteConfigDataApi = (id) => {
    return service({
        url: `/configManage/configData/${id}`,
        method: "DELETE",
    })
}

// 根据配置类型获取配置数据信息
export const getConfigDataApi = (data) => {
    return service({
        url: "/configManage/getConfigData",
        method: "GET",
        params: data,
    })
}

// 根据配置类型获取配置默认值
export const getConfigDefaultApi = (data) => {
    return service({
        url: "/configManage/getConfigDefault",
        method: "GET",
        params: data,
    })
}
// 修改配置数据信息
export const updateConfigDataApi = (data) => {
    return service({
        url: "/configManage/updateConfigData",
        method: "POST",
        data,
    })
}

// 启用配置类型信息
export const startConfigApi = (id) => {
    return service({
        url: `/configManage/${id}`,
        method: "PUT",
    })
}

// 停用配置类型信息
export const endConfigApi = (id) => {
    return service({
        url: `/configManage/${id}`,
        method: "DELETE",
    })
}
// 添加图片
export const addPictureApi = (configKey, data) => {
    return service({
        url: `/configValue/addPicture/${configKey}`,
        method: "PUT",
        data,
        headers: { 'Content-Type': 'multipart/form-data' }
    })
}
// 删除图片
export const deletePictureApi = (data) => {
    return service({
        url: `/configValue/delPicture/${data.configKey}?index=${data.configLabel}`,
        method: "DELETE",
    })
}
// 获取可配置参数信息列表
export const getConfigValueListApi = () => {
    return service({
        url: `/configValue/getConfigList`,
        method: "GET",
    })
}
// 修改可配置参数信息列表
export const updateConfigValueApi = (data) => {
    return service({
        url: `/configValue/updateConfigValue/${data.configKey}?value=${data.configValue}`,
        method: "POST",
    })
}